# -*- coding: utf-8 -*-
import os.path
from flask import Flask
from flask import render_template
from flask import send_from_directory


app = Flask(__name__)
page_list = [
    'cartesian_product',
    'find_all_path',
    'array_list',
    'zzjt1',
    'zzjt2',
]


@app.route('/')
def index():
    return render_template('index.html')


@app.route('/test')
def test():
    return render_template('test.html')


@app.route('/favicon.ico')
def favicon():
    favicon_path = os.path.join(app.root_path, 'static/img')
    return send_from_directory(favicon_path, 'favicon.ico')


@app.route('/<md>')
def page(md):
    if md in page_list:
        return render_template('page.html', page=md)
    else:
        return '<h1>404</h1>'


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8080)
